package com.catchu.dao;

import com.catchu.domain.User;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;

/**
 * @author 刘俊重
 * @Description
 * @date 11:42
 */
public interface UserRepository extends JpaRepository<User, Long> {

//    @Transactional(timeout = 10)
//    @Modifying
//    @Query("update User set userName = ?1 where id = ?2")
//    int modifyById(String  userName, Long id);
    @Modifying
    @Query(value = "update user set name=?1 where id=?2",nativeQuery = true)
    int modifyByid(String name,Long id);

}
